<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // setTimeout(function(){
        //     console.log("first");
        //     setTimeout(function(){
        //         console.log("second");
        //         setTimeout(function(){
        //             console.log("third")
        //         },1000);
        //     },1000);
        // },1000);

        function timeout(){
            return new Promise(function(resove,reject){
                setTimeout(function(){
                    resove();
                },1000);
            })
        }
        // let promise = timeout();
        // promise.then(function(){
        //     console.log("first")
        //     return timeout()
        // }).then(function(){
        //     console.log("second");
        //     return timeout();
        // }).then(function(){
        //     console.log("third");

        // });

        show();

        async function show(){
            await timeout();
            console.log("first");
            await timeout();
            console.log("second");
            await timeout();
            console.log("third");
        }
        
        
    </script>
</body>
</html>